import {service} from "./baseRequest"
import { useUserStore } from "@/stores/user"


/**
 * 
 * @param postName 
 * @param postContent 
 * @returns 
 */
export function CreatePost(postName:any,postContent:any){
    const userStore = useUserStore()
    const data = {
        postContent,
        postName,
        // token:userStore.token
    }
    return service({
        url:'/post',
        method:'post',
        params:data
    })
}



export function getPostByPostId(postId:any){
    const data = {
        postId,
    }
    return service({
        url:'/post',
        method:'get',
        data:data
    })
}

/**
 * 获取所有post
 * @returns 
 */
export function getPosts(per_page:number,pageNumber:number){
    const data = {
        per_page:per_page,
        pageNumber
    }
    return service({
        url:'/post',
        method:'get',
        params:data
    })
}
